
// This prog generates group identifyers faster than egen group 

// Code found here: 
* http://www.statalist.org/forums/forum/general-stata-discussion/general/119619-why-doesn-t-egen-group-produce-int-or-long-variables-by-default

// JM - Aug. 1st, 2016 


cap program drop id_group 

program id_group 

bysort `2': g firstobs = _n == 1
g long `1' = sum(firstobs) if !mi("`2'")
drop firstobs 

end
